<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html>
<html lang="zh" xml:lang="zh"
      xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://xmlns.jcp.org/jsf/html"
      xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
      xmlns:f="http://xmlns.jcp.org/jsf/core"
      xmlns:p="http://xmlns.jcp.org/jsf/passthrough">
<ui:composition template="templates/common.xhtml">
    <ui:define name="pageTitle">#{labels.appName}</ui:define>
    <ui:define name="mainContents">
        <div class="row">
            <div class="large-10 large-centered columns">
                <nav class="breadcrumbs">
                    <h:outputLink value="index.html">#{labels.commonMenuGlance}</h:outputLink>
                    <h:outputLink value="#{'#'}" styleClass="unavailable">#{labels.commonMenuVenue}</h:outputLink>
                    <h:outputLink value="#{'#'}" styleClass="current">#{labels.commonMenuAdminRoleManage}</h:outputLink>
                </nav>
            </div>
        </div>
        <div class="row">
            <div class="large-11 large-centered columns">
                <div class="row">
                    <h:form id="role_man_form">
                        <div class="large-4 large-offset-2 columns">
                            <fieldset>
                                <legend>#{labels.roleManageRoles}</legend>
                                <h:selectOneListbox id="adminrole" style="background: none; height: 100%;" size="19"
                                                    value="#{adminRoleBean.selectedRole}"
                                                    valueChangeListener="#{roleManageSelectBean.listRoleDetail}">
                                    <f:selectItem itemLabel="#{labels.formAddContent}" itemValue="new_content"/>
                                    <f:selectItems value="#{rolesBean.roles}" var="role"
                                                   itemLabel="#{role.role}" itemValue="#{role.svrid}" />
                                    <f:ajax render="@form"/>
                                </h:selectOneListbox>
                            </fieldset>
                        </div>
                        <div class="large-4 columns">
                            <fieldset>
                                <legend>#{roleManageFormBean.addMode?labels.roleManageRoleAdd:labels.roleManageRoleModify}</legend>
                                <h:outputLabel value="#{labels.roleManageRoleName}" for="roleName"/>
                                <h:inputText value="#{roleManageFormBean.roleName}" id="roleName"/>
                                <h:outputLabel value="#{labels.roleManageRolePrivilege}" for="roleprivileges"/>
                                <h:selectManyListbox id="roleprivileges" style="background: none; height: 100%;"
                                                     size="9" value="#{roleManageFormBean.selectedPrivileges}">
                                    <f:selectItems value="#{privilegesBean.allPrivileges}" var="privilege"
                                                   itemLabel="#{labels[privilege.localeSign]}" itemValue="#{privilege.codeSign}"/>
                                </h:selectManyListbox>
                                <ul class="button-group even-3">
                                    <li>
                                        <h:commandButton value="#{labels.formRemove}"
                                                         action="#{adminRoleBean.deleteRole}"
                                                         styleClass="button small alert"
                                                         onclick="return confirm('#{labels.roleManageConfirmDelete}');">
                                            <f:ajax execute="adminrole" render="@form"/>
                                        </h:commandButton>
                                    </li>
                                    <li>
                                        <h:commandButton value="#{labels.formSave}" action="#{adminRoleBean.saveRole}"
                                                         styleClass="button small btn-primary">
                                            <f:ajax execute="@form" render="@form"/>
                                        </h:commandButton>
                                    </li>
                                    <li>
                                        <h:commandButton value="#{labels.formReset}" type="reset"
                                                         styleClass="button small secondary"/>
                                    </li>
                                </ul>
                            </fieldset>
                        </div>
                        <h:inputHidden id="addmode" value="#{roleManageFormBean.addMode}"/>
                    </h:form>
                </div>
            </div>
        </div>
    </ui:define>
</ui:composition>
</html>
